<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/html">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/js/jQuery/jquery-2.2.3.min.js"></script>
    <script>
    //获取市
        function getClist() {
        var province =$("#province1").val();
        $.ajax({
            url : "/order/getClist",
            type : "post",
            data : {province:province},
            dataType : "json",
            async : false,
            success : function (result){
            var list =result.data;
            var  table="";
                table+="<option value='-1'>请选择</option>";
            for (var i = 0; i <list.length ; i++) {
                table+="<option value='"+list[i].cityid+"'>"+list[i].city+"</option>";
        }
        $("#city1").html(table);

        },
        error : function (e){
        alert("网络异常, 请稍后再试");
        }
        })
    }

    //获取县
    function getAlist() {
    var areaid =$("#city1").val();
    $.ajax({
                url : "/order/getAlist",
                type : "post",
                data : {areaid:areaid},
                dataType : "json",
                async : false,
                success : function (result){
                var list =result.data;
                var  table="";
                    table+="<option value='-1'>请选择</option>";
                for (var j = 0; j < list.length; j++) {
                    table+="<option value='"+list[j].areaid+"'>"+list[j].area+"</option>";
            }

        $("#district1").html(table);

        },
        error : function (e){
            alert("网络异常, 请稍后再试");
            }
        })
    }
    </script>
</head>
<body>
<!--新增地址弹出层-->
                <form action="" class="sui-form form-horizontal" id="formid">
                    <div class="control-group">
                        <label class="control-label">收货人：</label>
                        <div class="controls">
                            <input type="text" class="input-medium" name="contact">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">所在地区：</label>
                        <div class="controls">
                            <div data-toggle="distpicker">
                                <div class="form-group area">
                                    <select class="form-control" id="province1" onchange="getClist()" name="provinceId">
                                        <option value="-1">请选择</option>
                                        <th:block th:each="gk : ${plist}">
                                            <option th:value="${gk.provinceid}">[[${gk.province}]]</option>
                                        </th:block>
                                    </select>
                                </div>
                                <div class="form-group area">
                                    <select class="form-control" id="city1" onchange="getAlist()" name="cityId">

                                    </select>
                                </div>
                                <div class="form-group area">
                                    <select class="form-control" id="district1" name="townId"></select>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">详细地址：</label>
                        <div class="controls">
                            <input type="text" class="input-large" name="address">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">联系电话：</label>
                        <div class="controls">
                            <input type="text" class="input-medium" name="mobile">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">邮箱：</label>
                        <div class="controls">
                            <input type="text" class="input-medium">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">地址别名：</label>
                        <div class="controls">
                            <input type="text" class="input-medium" name="alias">
                        </div>
                        <div class="othername">
                            建议填写常用地址：<a href="#" class="sui-btn btn-default">家里</a>　<a href="#" class="sui-btn btn-default">父母家</a>　<a href="#" class="sui-btn btn-default">公司</a>
                        </div>
                    </div>
                </form>
</body>
</html>